﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_REF_TOUR_Insert')
	BEGIN
		DROP Procedure usp_UPDMS_REF_TOUR_Insert
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_REF_TOUR_Insert
**	Desc : 기행기를 저장한다.
**	Test Exec Query : Exec usp_UPDMS_REF_TOUR_Insert
**	Called by : Ref_Dac_UPDMS_REF_TOUR.cs
**	Program ID : Ref1012m
**	Auth : 송시명
**	Date : 2013-04-17
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_REF_TOUR_Insert]
@Seq int,
@Shop_Id nvarchar(5),
@Nick_Nm nvarchar(200),
@Running_Time int,
@Tour_Dt nvarchar(10),
@Tour_Hour nvarchar(2),
@Tour_Minute nvarchar(2),
@Place nvarchar(50),
@Price int,
@HomeRun_Yn nvarchar(5),
@Satisfaction nvarchar(5),
@Contents nvarchar(max),
@Keyword nvarchar(2000),
@Latitude nvarchar(50),
@Longitude nvarchar(50),
@Attach_File_Info nvarchar(max),
@Create_User nvarchar(20),
@Create_Dt datetime,
@Update_User nvarchar(20),
@Update_Dt datetime
AS
SET NOCOUNT OFF

DECLARE @New_Seq int

INSERT INTO UPDMS_REF_TOUR (
       Shop_Id,
       Nick_Nm,
       Running_Time,
       Tour_Dt,
       Tour_Hour,
       Tour_Minute,
       Place,
       Price,
       HomeRun_Yn,
       Satisfaction,
       Contents,
       Keyword,
       Latitude,
       Longitude,
       Create_User,
       Create_Dt,
       Update_User,
       Update_Dt
)
VALUES (
       @Shop_Id,
       @Nick_Nm,
       @Running_Time,
       @Tour_Dt,
       @Tour_Hour,
       @Tour_Minute,
       @Place,
       @Price,
       @HomeRun_Yn,
       @Satisfaction,
       @Contents,
       @Keyword,
       @Latitude,
       @Longitude,
       @Create_User,
       GETDATE(),
       @Update_User,
       GETDATE()
)

SET @New_Seq = @@IDENTITY

--첨부파일 저장
EXEC usp_UPDMS_COM_FILE_Insert_Xml @New_Seq, 'Ref1012m', @Attach_File_Info

GO